<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class ProjectRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return false;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $project = $this->projectResource();
        $id = (int) optional($project)->id;
        $rules = [
            'project_name' => 'required|max:100',
            'region_id' => 'required|max:100',
            'project_leader_name' => 'required|max:100',
            'project_leader_phone' => 'required|max:100',
            'project_describe' => 'required|max:255',
            'push_type' => 'required|max:255',
        ];
        return $rules;
    }
    public function projectResource()
    {
        return $this->route('project');
    }

    public function attributes()
    {
        return [
            'project_name' => '项目名称',
            'region_id' => '所在地区',
            'project_leader_name' => '项目负责人姓名',
            'project_leader_phone' => '项目负责人手机',
            'project_describe' => '项目描述',
            'push_type' => '推送类型',
        ];
    }
}
